convert xml.documentElement.getElementsByTagName("marker")[index].getAttribute(temp) to string in ja

Posted by user324884 on Stack Overflow See other posts from Stack Overflow or by user324884
Published on 2010-04-24T11:04:12Z Indexed on 2010/04/24 11:13 UTC
Read the original article Hit count: 321

Filed under:

I am parsing xml file in javascript and after that want to cancatenate all the the data into string. but failing to do the same and it is returning undefined.

      GDownloadUrl("./include/dataemp2.xml", function(data) {
      var xml = GXml.parse(data);
      markers = xml.documentElement.getElementsByTagName("marker");
       for(var t=0;t<18;t++)
         {
           var temp= markers[index].getAttribute("address");
          html = html + temp;
          }
         });

it is returning as undefined because temp is not concatenating in "html"; whereas when i do this like html = html +markers[index].getAttribute("address"); it is giving me expected output;

© Stack Overflow or respective owner

Related posts about JavaScript